package cn.kt.common.vo;

import cn.kt.common.pojo.BasePojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ktResult extends BasePojo {
    private static final long serialVersionUID = -4180641420295378550L;
    //属性个数:  1.status 200/201   2.msg 服务器提示信息  3.data 服务器返回值数据
    private Integer status;
    private String msg;
    private Object data;

    //实现方法封装
    //失败
    public static ktResult fail(){
        return new ktResult(201,"任务执行失败",null);
    }
    public static ktResult fail(Integer status){
        return new ktResult(status,"任务执行失败",null);
    }
    public static ktResult fail(String msg){
        return new ktResult(201,msg,null);
    }
    public static ktResult fail(String msg,Object data){
        return new ktResult(201,msg,data);
    }

    //成功
    public static ktResult success(){
        return new ktResult(200,"任务执行完成",null);
    }
    public static ktResult success(String msg){
        return new ktResult(200,msg,null);
    }
    public static ktResult success(Object data){

        return new ktResult(200,"任务执行完成",data);
    }
    public static ktResult success(String msg,Object data){

        return new ktResult(200,msg,data);
    }
}
